from django.urls import re_path,path
from . import views

# 路由映射列表
urlpatterns = [
    # 路由映射公式： 请求方式 + 路径 = 视图函数
    # GET +usernames/(?P<username>[a-zA-Z0-9_-]{5,20})/count = UsernameCountView.get()
    re_path(r'^usernames/(?P<username>[a-zA-Z0-9_-]{5,20})/count/$', views.UsernameCountView.as_view()),
    path('mobiles/<mobile:mobile>/count/',views.MobileCountView.as_view()),
    path('register/',views.RegisterView.as_view()),
    path('login/',views.LoginView.as_view()),
    path('logout/',views.LogoutView.as_view()),
    path('emails/',views.EmailView.as_view()),
    path('info/',views.UserInfoView.as_view()),
    path('emails/verification/',views.VerifyEmailView.as_view()),
    path('addresses/create/',views.CreateAddressView.as_view()),
    path('addresses/',views.AddressView.as_view()),
    path('addresses/<int:address_id>/', views.UpdateDestroyAddressView.as_view()),
    path('addresses/<int:address_id>/default/',views.DefaultAddressView.as_view()),
    path('addresses/<int:address_id>/title/',views.UpdateTitleAddressView.as_view()),
    path('password/',views.ChangePasswordView.as_view())
]